package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.dao.UserDao;
import com.itheima.service.UserService;

/**
 * @program: Spring_day01_01_IOC入门程序
 * @description:
 * @author: xuejingjing
 * @create: 2021-07-24 16:52
 **/
public class UserServiceImpl implements UserService {
    /**
     * 把UserDao和BookDao注入到这个ServiceImpl中，目的就是要调用这个接口的方法呀
     * 所以这才是关键
     */
    private UserDao userDao;
    private BookDao bookDao;

    //通过set注入的时候，那肯定得有构造方法呀，不然怎么让对象调用set方法。

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public void setBookDao(BookDao bookDao) {
        this.bookDao = bookDao;
    }


    public void save() {
        System.out.println("UserServiceImpl执行了");
        userDao.save();
        bookDao.save();
    }
}
